xen/arm: Correct the p2m pool size calculations
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 20 Oct 2022 11:14:30 +0000 (12:14 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 17 Nov 2022 16:51:51 +0000 (16:51 +0000)
commitdb8fa01c61db0317a9ee947925226234c65d48e8
tree27a85c50923460f62a661de72913fde46bb9c3a2
parent7c3bbd940dd8aeb1649734e5055798cc6f3fea4e
xen/arm: Correct the p2m pool size calculations

Allocating or freeing p2m pages doesn't alter the size of the mempool; only
the split between free and used pages.

Right now, the hypercalls operate on the free subset of the pool, meaning that
XEN_DOMCTL_get_paging_mempool_size varies with time as the guest shuffles its
physmap, and XEN_DOMCTL_set_paging_mempool_size ignores the used subset of the
pool and lets the guest grow unbounded.

This fixes test-pagign-mempool on ARM so that the behaviour matches x86.

This is part of XSA-409 / CVE-2022-33747.

Fixes: cbea5a1149ca ("xen/arm: Allocate and free P2M pages from the P2M pool")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Release-acked-by: Henry Wang <Henry.Wang@arm.com>
xen/arch/arm/p2m.c